package cn.iocoder.yudao.module.ai.controller.admin.picture.web;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.ai.controller.admin.picture.vo.PicturePageReqVO;
import cn.iocoder.yudao.module.ai.controller.admin.picture.vo.PictureRespVO;
import cn.iocoder.yudao.module.ai.dal.dataobject.picture.PictureDO;
import cn.iocoder.yudao.module.ai.service.picture.PictureService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 图片")
@RestController
@RequestMapping("/web/ai/picture")
@Validated
public class WebPictureController {

    @Resource
    private PictureService pictureService;

    @GetMapping("/page")
    @Operation(summary = "获得图片分页")
    public CommonResult<PageResult<PictureRespVO>> getPicturePage(@Valid PicturePageReqVO pageReqVO) {
        PageResult<PictureDO> pageResult = pictureService.getPicturePage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, PictureRespVO.class));
    }


}